package com.lunwen.lunwen.services.impl;

import com.lunwen.lunwen.bean.ThesisTaskLog;
import com.lunwen.lunwen.mapper.ThesisTaskLogMapper;
import com.lunwen.lunwen.services.ThesisTaskLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (ThesisTaskLog)表服务实现类
 *
 * @author makejava
 * @since 2020-08-12 09:38:08
 */
@Service
public class ThesisTaskLogServiceImpl implements ThesisTaskLogService {

    @Autowired
    private ThesisTaskLogMapper thesisTaskLogMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param thesistasklogId 主键
     * @return 实例对象
     */
    @Override
    public ThesisTaskLog queryById(Long thesistasklogId) {
        return this.thesisTaskLogMapper.queryById(thesistasklogId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ThesisTaskLog> queryAllByLimit(int offset, int limit) {
        return this.thesisTaskLogMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param thesisTaskLog 实例对象
     * @return 实例对象
     */
    @Override
    public ThesisTaskLog insert(ThesisTaskLog thesisTaskLog) {
        this.thesisTaskLogMapper.insert(thesisTaskLog);
        return thesisTaskLog;
    }

    /**
     * 修改数据
     *
     * @param thesisTaskLog 实例对象
     * @return 实例对象
     */
    @Override
    public ThesisTaskLog update(ThesisTaskLog thesisTaskLog) {
        this.thesisTaskLogMapper.update(thesisTaskLog);
        return this.queryById(thesisTaskLog.getThesistasklogId());
    }

    /**
     * 通过主键删除数据
     *
     * @param thesistasklogId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long thesistasklogId) {
        return this.thesisTaskLogMapper.deleteById(thesistasklogId) > 0;
    }
}